import request from "@/utils/request";
import store from "@/store";
// 发薪审批-审批中
export function pageApproving(data) {
  return request({
    url: `/hr/api/v1/transferAccountsBatches/pageApproving`,
    method: "GET",
    params: data
  });
}
// 发薪审批-已通过：
export function pageApprovedPass(data) {
  return request({
    url: `/hr/api/v1/transferAccountsBatches/pageApprovedPass`,
    method: "GET",
    params: data
  });
}
// ：发薪审批-已驳回：
export function pageApprovedReject(data) {
  return request({
    url: `/hr/api/v1/transferAccountsBatches/pageApprovedReject`,
    method: "GET",
    params: data
  });
}
// 抄送我：
export function pageApproveNotifierMe(data) {
  return request({
    url: `/hr/api/v1/transferAccountsBatches/pageApproveNotifierMe`,
    method: "GET",
    params: data
  });
}
export function getWeiXinList(params) {
  return request({
    url: `/hr/api/v1/transferAccountInfos/listAll`,
    method: "GET",
    params: params
  });
}

export function sendCode(phone) {
  return request({
    url: `/hr/api/v1/transferAccountsBatches/sendSafetyPayPhoneMessage/${phone}`,
    method: "GET"
  });
}

export function huaBeiPaySalary(data) {
  return request({
    url: `/hr/api/v1/transferAccountsBatches/zfbSafetyStartTransferAccounts`,
    method: "post",
    data
  });
}
export function bankPaySalary(data) {
  return request({
    url: `/hr/api/v1/transferAccountsBatches/pingAnStartTransferAccounts`,
    method: "post",
    data
  });
}
export const userApproDetails = moduleType => {
  return request({
    url: `/hr/api/v1/hrApproProviders/userApproDetails/${moduleType}`,
    method: "get"
  });
};
export function returnAuthorizationUrl(params) {
  return request({
    url: `/hr/api/v1/transferAccountsBatches/returnAuthorizationUrl`,
    method: "GET",
    params
  });
}
export function transferAccountsDetails(data) {
  return request({
    url: `/hr/api/v1/transferAccountsDetails`,
    method: "get",
    params: data
  });
}
export function editAccountsDetails(data) {
  return request({
    url: `/hr/api/v1/transferAccountsDetails`,
    method: "PUT",
    data
  });
}
export function weixinPaySalary(data) {
  return request({
    url: `/hr/api/v1/transferAccountsBatches/vxStartTransferAccounts`,
    method: "post",
    data
  });
}
export function batchAccountsDetails(data) {
  return request({
    url: `/hr/api/v1/transferAccountsDetails/updateBatch`,
    method: "PUT",
    data
  });
}
export function batchAccountsDetails2(data) {
  return request({
    url: `/hr/api/v1/transferAccountsDetails/updateBatchAndBatchInfo`,
    method: "PUT",
    data
  });
}
//
export function paySalary(data) {
  return request({
    url: "/hr/api/v1/transferAccountsBatches/zfbStartTransferAccounts",
    method: "POST",
    data
  });
}
export function pageRefresh(transferAccountsBatchId) {
  return request({
    url: `/hr/api/v1/transferAccountsBatches/${transferAccountsBatchId}`,
    method: "GET"
  });
}
export function getResults(salaryTransferAccountsBatchId) {
  return request({
    url: `/hr/api/v1/transferAccountsBatches/selectTransferAccountsBatch/${salaryTransferAccountsBatchId}`,
    method: "GET"
  });
}
export function getAllByCompany(companyId) {
  return request({
    url: `/approval/api/v1/approFlows/allByCompany/${companyId}/hr?moduleType=hr&type=transferAccounts&inUse=true`,
    method: "get"
  });
}

export function approvalHandlerRejectReq(approvalId, data) {
  return request({
    url: `/approval/api/v1/userFlowApprovers/reject/${approvalId}`,
    method: "put",
    data
  });
}

export function approvalHandlerAgreeReq(approvalId, data) {
  return request({
    url: `/approval/api/v1/userFlowApprovers/pass/${approvalId}`,
    method: "put",
    data
  });
}

export function allGroupAndFlowByCompanySite() {
  return request({
    url: `/approval/api/v1/approFlowGroups/allGroupAndFlowByCompanySite/defaultTransferAccounts/hr`,
    method: "get"
  });
}
